﻿using IRepositoryBll;
using IRepositoryDal;
using RepositoryEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RepositoryBll
{
    /// <summary>
    /// 部门业务访问层
    /// </summary>
    public class DepartmentInfoBll : IDepartmentInfoBll
    {
        private IDepartmentInfoDal _departmentInfoDal;

        public DepartmentInfoBll(IDepartmentInfoDal departmentInfoDal)
        {
            _departmentInfoDal = departmentInfoDal;
        }

        /// <summary>
        /// 添加部门
        /// </summary>
        /// <param name="departmentInfo"></param>
        /// <returns></returns>
        public bool AddDepartmentInfo(DepartmentInfo departmentInfo)
        {
            //DepartmentInfoDal departmentInfoDal = new DepartmentInfoDal();
            return _departmentInfoDal.Add(departmentInfo);
        }

        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="departmentInfoId"></param>
        /// <returns></returns>
        public bool DeleteDepartmentInfo(string departmentInfoId)
        {
            return _departmentInfoDal.Delete(departmentInfoId);
        }

        /// <summary>
        /// 根据id获取部门
        /// </summary>
        /// <param name="departmentInfoId"></param>
        /// <returns></returns>
        public DepartmentInfo GetDepartmentInfo(string departmentInfoId)
        {
            return _departmentInfoDal.GetDepartmentInfo(departmentInfoId);
        }

        /// <summary>
        /// 更新部门
        /// </summary>
        /// <param name="departmentInfo"></param>
        /// <returns></returns>
        public bool UpdateDepartmentInfo(DepartmentInfo departmentInfo)
        {
            return _departmentInfoDal.Update(departmentInfo);
        }
    }
}
